/*
 * PyrolysisGasEnergyKernel.C
 *
 *  Created on: 2017年8月31日
 *      Author: liuxiao
 */
/*
 * PoreTemperatureTimeAsSourceKernel.C
 *
 *  Created on: 2017年7月24日
 *      Author: liuxiao
 */


#include "PyrolysisGasEnergyKernel.h"
registerMooseObject("TrilobitaApp", PyrolysisGasEnergyKernel);
template<>
InputParameters validParams<PyrolysisGasEnergyKernel>()
{
  InputParameters params = validParams<Kernel>();
  params.addClassDescription("Compute pyrolysis gas energy kernel ");
  params.addRequiredCoupledVar("pressure", "Coupled Pressure");
  return params;
}

PyrolysisGasEnergyKernel::PyrolysisGasEnergyKernel(const InputParameters & parameters) :
  Kernel(parameters),
  _gradient_P_value(coupledGradient("pressure")),
  _rhog(getMaterialProperty<Real>("rhog")),
  _cpg(getMaterialProperty<Real>("cpg")),
  _permeability(getMaterialProperty<Real>("permeability")),
  _viscosity(getMaterialProperty<Real>("viscosity"))
{

}

Real PyrolysisGasEnergyKernel::computeQpResidual()
{
//	std::cout << _k[_qp] <<std::endl;
  Real r(0);
  RealVectorValue mg =_rhog[_qp]*_permeability[_qp]/_viscosity[_qp]*_gradient_P_value[_qp];
  r = mg*_cpg[_qp]*_grad_u[_qp]*_test[_i][_qp];
  return -r;
}

Real PyrolysisGasEnergyKernel::computeQpJacobian()
{
  Real jac(0);
  RealVectorValue mg =_rhog[_qp]*_permeability[_qp]/_viscosity[_qp]*_gradient_P_value[_qp];
  jac = mg*_cpg[_qp]*_grad_phi[_i][_qp]*_test[_i][_qp];
  return -jac;
}










